# coding: utf-8
# Author: legend
# @Time： 2020/8/27 下午10:05
from utils.messages.router import DefaultRouter
from websocket.handlers.cpu_load import MultiDeviceCpuLoadRequestHandler, LatestDeviceCpuLoadRequestHandler
from websocket.handlers.cpu_status import MultiDeviceCpuStatusRequestHandler, LatestDeviceCpuStatusRequestHandler
from websocket.handlers.disk_io import MultiDeviceDiskIORequestHandler, LatestDeviceDiskIORequestHandler
from websocket.handlers.memory_status import MultiDeviceMemoryStatusRequestHandler, \
    LatestDeviceMemoryStatusRequestHandler
from websocket.handlers.network_card_status import MultiDeviceNetworkCardStatusRequestHandler, \
    LatestDeviceNetworkCardStatusRequestHandler
from websocket.handlers.partition_status import MultiDevicePartitionStatusRequestHandler, \
    LatestDevicePartitionStatusRequestHandler
from websocket.handlers.process_status import MultiDeviceProcessStatusRequestHandler, \
    LatestDeviceProcessStatusRequestHandler
from websocket.handlers.service import LatestServiceRunningDataRequestHandler, MultiServiceRunningDataRequestHandler
from websocket.handlers.snowflake import SnowFlakeRequestHandler
from websocket.handlers.user import ServerTimeRequestHandler, UserPingRequestHandler
from websocket.messages import *

router = DefaultRouter()

# router.register('请求'，'请求处理器', '响应', '响应处理器')

# 全局唯一ID请求
router.register(SnowFlakeRequest, SnowFlakeRequestHandler, SnowFlakeResponse)

# 多条设备CPU负载数据
router.register(MultiDeviceCpuLoadRequest,
                MultiDeviceCpuLoadRequestHandler,
                MultiDeviceCpuLoadResponse)
# 单条设备CPU负载数据
router.register(LatestDeviceCpuLoadRequest,
                LatestDeviceCpuLoadRequestHandler,
                LatestDeviceCpuLoadResponse)
# 多条设备CPU状态数据
router.register(MultiDeviceCpuStatusRequest,
                MultiDeviceCpuStatusRequestHandler,
                MultiDeviceCpuStatusResponse)
# 单条设备CPU状态数据
router.register(LatestDeviceCpuStatusRequest,
                LatestDeviceCpuStatusRequestHandler,
                LatestDeviceCpuStatusResponse)
# 多条设备硬盘io数据
router.register(MultiDeviceDiskIORequest,
                MultiDeviceDiskIORequestHandler,
                MultiDeviceDiskIOResponse)
# 单条设备硬盘io数据
router.register(LatestDeviceDiskIORequest,
                LatestDeviceDiskIORequestHandler,
                LatestDeviceDiskIOResponse)
# 多条硬盘使用率
router.register(MultiDevicePartitionStatusRequest,
                MultiDevicePartitionStatusRequestHandler,
                MultiDevicePartitionStatusResponse)
# 单条硬盘使用率
router.register(LatestDevicePartitionStatusRequest,
                LatestDevicePartitionStatusRequestHandler,
                LatestDevicePartitionStatusResponse)
# 多条设备内存数据
router.register(MultiDeviceMemoryStatusRequest,
                MultiDeviceMemoryStatusRequestHandler,
                MultiDeviceMemoryStatusResponse)
# 单条设备内存数据
router.register(LatestDeviceMemoryStatusRequest,
                LatestDeviceMemoryStatusRequestHandler,
                LatestDeviceMemoryStatusResponse)
# 多条进程状态数据
router.register(MultiDeviceProcessStatusRequest,
                MultiDeviceProcessStatusRequestHandler,
                MultiDeviceProcessStatusResponse
                )
# 单挑条进程状态数据
router.register(LatestDeviceProcessStatusRequest,
                LatestDeviceProcessStatusRequestHandler,
                LatestDeviceProcessStatusResponse
                )

# 多条设备网卡数据
router.register(MultiDeviceNetworkCardStatusRequest,
                MultiDeviceNetworkCardStatusRequestHandler,
                MultiDeviceNetworkCardStatusResponse)
# 单条设备网卡数据
router.register(LatestDeviceNetworkCardStatusRequest,
                LatestDeviceNetworkCardStatusRequestHandler,
                LatestDeviceNetworkCardStatusResponse)
# 最后一条服务运行数据
router.register(LatestServiceRunningDataRequest,
                LatestServiceRunningDataRequestHandler,
                LatestServiceRunningDataResponse)
# 多条服务运行数据
router.register(MultiServiceRunningDataRequest,
                MultiServiceRunningDataRequestHandler,
                MultiServiceRunningDataResponse)
# # 设备上的服务
# router.register(ServiceOnDeviceRequest,
#                 ServiceOnDeviceRequestHandler,
#                 ServiceOnDeviceResponse)
# # 最后一条业务数据
# router.register(LatestBusinessDataRequest,
#                 LatestBusinessRequestHandler,
#                 LatestBusinessDataResponse)
# # 多条业务数据
# router.register(MultiBusinessDataRequest,
#                 MultiBusinessDataRequestHandler,
#                 MultiBusinessDataResponse)
# 服务器时间
router.register(ServerTimeRequest,
                ServerTimeRequestHandler,
                ServerTimeResponse)
# ping
router.register(UserPingRequest,
                UserPingRequestHandler,
                UserPingResponse)

router.register(response_serializer_class=ServiceConfigChangeResultResponse)
router.register(response_serializer_class=AppUpgradeResultResponse)
router.register(response_serializer_class=LogTailerStreamResponse)
router.register(response_serializer_class=DeviceActivateResponse)
router.register(response_serializer_class=BatchRestartAgentServiceResponse)
router.register(response_serializer_class=ChangeServiceConfigResponse)

routes = router.routes
